package com.abbas.smartCity.ui.youthInn;

import android.annotation.SuppressLint;
import android.widget.TextView;

import com.abbas.smartCity.R;
import com.abbas.smartCity.adapter.BannerImageAdapter2;
import com.abbas.smartCity.base.BaseActivity;
import com.abbas.smartCity.bean.inn.InnDetailBean;
import com.abbas.smartCity.retroft.ICallback;
import com.youth.banner.Banner;
import com.youth.banner.indicator.CircleIndicator;

import retrofit2.Call;

public class InnDetailActivity extends BaseActivity {

    private Banner<String, BannerImageAdapter2<String>> banner;
    private TextView introduce;
    private TextView internalFacilities;
    private TextView surroundingFacilities;
    private TextView specialService;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_inn_deatil;
    }

    @Override
    protected String setCustomTitle() {
        return "驿站详情";
    }

    @Override
    protected void initView() {
        banner = findViewById(R.id.banner);
        introduce = (TextView) findViewById(R.id.introduce);
        internalFacilities = (TextView) findViewById(R.id.internalFacilities);
        surroundingFacilities = (TextView) findViewById(R.id.surroundingFacilities);
        specialService = (TextView) findViewById(R.id.specialService);

    }

    @Override
    protected void initData() {
        final int id = getIntent().getIntExtra("id", -1);
        api.getInnDetail(id).enqueue(new ICallback<InnDetailBean>() {
            @SuppressLint("SetTextI18n")
            @Override
            public void onSuccess(Call<InnDetailBean> call, InnDetailBean data) {
                banner.setAdapter(new BannerImageAdapter2<>(data.getData().getImageUrlList()))
                        .setIndicator(new CircleIndicator(InnDetailActivity.this))
                        .start();

                final InnDetailBean.DataBean dataBean = data.getData();
                introduce.setText("驿站简介:" + dataBean.getIntroduce() + "");
                internalFacilities.setText("房间配置:" + dataBean.getInternalFacilities() + "");
                surroundingFacilities.setText("周边配套:" + dataBean.getSurroundingFacilities() + "");
                specialService.setText("特色服务" + dataBean.getSpecialService() + "");
            }
        });
    }

    @Override
    protected void initEvent() {

    }
}